
import wx
import wx.grid as grid

class HexEditor(wx.Panel):
    
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        self._bar = self._create_tool_bar()
        self._grid = HexEditorGrid(self)
        sizer.Add(self._bar, 0, wx.EXPAND)
        sizer.Add(self._grid, 1, wx.EXPAND)
        self.SetSizer(sizer)

    def _create_tool_bar(self):
        bar = wx.ToolBar(self, style=wx.TB_FLAT|wx.TB_HORIZONTAL)
        bar.AddControl(wx.StaticText(bar, -1, "Address:"))
        bar.AddControl(wx.TextCtrl(bar, -1))
        bar.Realize()
        return bar
    
class HexEditorGrid(grid.Grid): 
    
    def __init__(self, parent):
        grid.Grid.__init__(self, parent, -1)
        self.CreateGrid(25, 18)
        self.AutoSizeColumns(False)
        self.SetRowLabelSize(0)
        self.SetColLabelValue(0, "Offset")
        self.SetColSize(0, 200)
        for index in range(0, 0x10):
            self.SetColLabelValue(index + 1, "0" + hex(index)[2:])
            self.SetColSize(index + 1, 20)
        self.SetColLabelValue(17, "String")
        self.SetColSize(17, 200)
        
        
        